package com.gitee.francis.lw.form.model.enums;

public enum FormResponseStatusEnum {

	SUCCESS(10000, "操作成功"), ERROR(10001, "操作出错"), FAIL(10002, "操作失败"), NOTFOUNT(
			10003, "未找到相对数据"), NOAUTH(10004, "没有权限访问"), JSONERROR(10005,
			"JSON数据格式出错"), PASSWORD_RESET_SUCCESS(10006, "密码修改成功"), FORM_ERROR(
			10007, "表单填写信息错误"), LOGIN_SUCCESS(10008, "登录成功"), PASSWORDERROR(
			10009, "密码错误"), USERLOCK(10010, "账户已锁定"), LOGINERRORTOOTIMES(10011,
			"错误次数过多");

	private int code;

	private String message;

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	private FormResponseStatusEnum(int code, String message) {
		this.code = code;
		this.message = message;
	}

	public static String getMessage(int code) {
		for (FormResponseStatusEnum responseStatus : FormResponseStatusEnum.values()) {
			if (responseStatus.code == code) {
				return responseStatus.message;
			}
		}
		return null;
	}
}
